home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / basic / ace24dist.lha / ace24.lha / include / intuition / Classes.h < prev    next >
C/C++ Source or Header  |  1996-09-10  |  3KB  |  110 lines

  1. #ifndef INTUITION_CLASSES_H
  2. #define INTUITION_CLASSES_H 1
  3. /*
  4. ** classes.h for ACE Basic
  5. **
  6. ** Note: Translated to ACE by ConvertC2ACE
  7. **       @ MapMeadow Software, Nils Sjoholm
  8. **
  9. **
  10. ** Date: 09/01/95
  11. **
  12. **
  13. */
  14.  
  15. /*
  16. ** This are the StructPointer defines for classes.h
  17. */
  18. #ifndef IClassPtr
  19. #define IClassPtr ADDRESS
  20. #endif
  21. #ifndef _ObjectPtr
  22. #define _ObjectPtr ADDRESS
  23. #endif
  24. /*
  25. ** End of StructPointer defines for classes.h
  26. */
  27.  
  28.  
  29. #ifndef UTILITY_HOOKS_H
  30. #include <utility/hooks.h>
  31. #endif
  32.  
  33. #ifndef INTUITION_CLASSUSR_H
  34. #include <intuition/classusr.h>
  35. #endif
  36.  
  37. /*******************************************/
  38. /*** "White box" access to STRUCT IClass ***/
  39. /*******************************************/
  40.  
  41. /* This structure is READ-ONLY,  and allocated only by Intuition */
  42. STRUCT IClass  
  43.     Hook cl_Dispatcher 
  44.     LONGINT       cl_Reserved     /* must be 0  */
  45.     IClassPtr  cl_Super 
  46.     ClassID     cl_ID 
  47.  
  48.     /* where within an object is the instance data for this class? */
  49.     SHORTINT       cl_InstOffset 
  50.     SHORTINT       cl_InstSize 
  51.  
  52.     LONGINT       cl_UserData     /* per-class data of your choice */
  53.     LONGINT       cl_SubclassCount 
  54.                     /* how many direct subclasses?  */
  55.     LONGINT       cl_ObjectCount 
  56.                 /* how many objects created of this class? */
  57.     LONGINT       cl_Flags 
  58. END STRUCT 
  59.  
  60.  
  61. #define CLF_INLIST  &H00000001  /* class is in public class LIST */
  62.  
  63. /* add offset for instance data to an object handle */
  64. /*
  65. #define INST_DATA( cl,  o )  ((BYTE *) (((BYTE  *)o)+cl->cl_InstOffset))
  66. */
  67. /* sizeof the instance data for a given class */
  68. /*
  69. #define SIZEOF_INSTANCE( cl )   ((cl)->cl_InstOffset + (cl)->cl_InstSize \
  70.             + _sizeof (STRUCT _Object ))     
  71. */
  72.  
  73. /**************************************************/
  74. /*** "White box" access to STRUCT _Object   ***/
  75. /**************************************************/
  76.  
  77. /*
  78.  * We have this,  the instance data of the root class,  PRECEDING
  79.  * the "object".  This is so that Gadget objects are Gadget pointers, 
  80.  * and so on.  If this structure grows,  it will always have o_Class
  81.  * at the end,  so the macro OCLASS(o) will always have the same
  82.  * offset back from the pointer returned from NewObject().
  83.  *
  84.  * This data structure is subject to change.  Do not use the o_Node
  85.  * embedded structure.
  86.  */
  87. STRUCT _Object  
  88.     MinNode o_Node 
  89.     IClassPtr  o_Class 
  90. END STRUCT 
  91.  
  92. /* convenient typecast  */
  93. /*
  94. #define _OBJ( o )   ((STRUCT _Object *)(o))
  95. */
  96. /* get "public" handle on baseclass instance from real beginning of obj data */
  97. /*
  98. #define BASEOBJECT( _obj )  ( (Object *) (_OBJ(_obj)+1) )
  99. */
  100. /* get back to object data STRUCT from public handle */
  101. /*
  102. #define _OBJECT( o )        (_OBJ(o) - 1)
  103. */
  104. /* get class pointer from an object handle  */
  105. /*
  106. #define OCLASS( o ) ( (_OBJECT(o))->o_Class )     
  107. */
  108.  
  109. #endif
  110.